// 题目为: 银行排队问题之单队列多窗口服务.png
#include <stdio.h>
typedef struct
{
    int T; // 顾客到达时间
    int P; // 事务处理时间
} Customer;
typedef struct
{
    int num;  // 总共服务过的顾客数量
    int time; // 服务结束时间
} Window;

int main()
{
    int N, K;
    float wait_mul = 0;
    int wait_max = 0;
    int final_time = 0;
    scanf("%d", &N);
    Customer customer[1000];
    Window window[10] = {0};
    int i, j;
    for (i = 0; i < N; i++)
    {
        scanf("%d%d", &customer[i].T, &customer[i].P);
        if (customer[i].P > 60)
        {
            customer[i].P = 60;
        }
    }
    scanf("%d", &K);
    for (i = 0; i < N; i++)
    {
        int time_min = 9999;
        int window_flag = -1;
        for (j = 0; j < K; j++)
        {
            if (window[j].time <= customer[i].T)
            {
                window[j].num++;
                if (window[j].time == customer[i].T)
                    window[j].time += customer[i].P;
                else
                    window[j].time = customer[i].T + customer[i].P;
                break;
            }
            else if (time_min > window[j].time - customer[i].T)
            {
                time_min = window[j].time - customer[i].T;
                window_flag = j;
            }
        }
        if (j == K)
        {
            wait_mul += time_min;
            if (time_min > wait_max)
                wait_max = time_min;
            window[window_flag].num++;
            window[window_flag].time += customer[i].P;
        }
    }
    for (i = 0; i < K; i++)
    {
        if (window[i].time > final_time)
            final_time = window[i].time;
    }
    printf("%.1f %d %d\n", wait_mul / N * 1.0, wait_max, final_time);
    for (i = 0; i < K; i++)
    {
        if (i != K - 1)
            printf("%d ", window[i].num);
        else
            printf("%d", window[i].num);
    }
    return 0;
}